const Router = require("koa-router")

/**
 * 路由对象
 * @type {Router}
 */
const router = new Router()

const banner_router = require('./banner')
const homeLinks_router = require('./homeLinks')
const studyTimeLine_router = require('./studyTimeLine')
const me_router = require('./me')
const production_router = require('./production')
const study_router = require('./study')
const feedback_router = require('./feedback')
const package_router = require('./package')
const ali_router = require('./ali')
const baidu_router = require('./baidu')
const server_router = require('./server')
const coding_router = require('./coding')
const docs_router = require('./docs')
const dashboard_router = require('./dashboard')
const work_router = require('./work')
const logs_router = require('./logs')
const pdf_router = require('./pdf')
router
	.use(banner_router.routes(), banner_router.allowedMethods())
	.use(homeLinks_router.routes(), homeLinks_router.allowedMethods())
	.use(studyTimeLine_router.routes(), studyTimeLine_router.allowedMethods())
	.use(me_router.routes(), me_router.allowedMethods())
	.use(production_router.routes(), production_router.allowedMethods())
	.use(study_router.routes(), study_router.allowedMethods())
	.use(feedback_router.routes(), feedback_router.allowedMethods())
	.use(package_router.routes(), package_router.allowedMethods())
  .use(ali_router.routes(), ali_router.allowedMethods())
  .use(baidu_router.routes(), baidu_router.allowedMethods())
  .use(server_router.routes(), server_router.allowedMethods())
	.use(coding_router.routes(), coding_router.allowedMethods())
	.use(docs_router.routes(), docs_router.allowedMethods())
	.use(dashboard_router.routes(), dashboard_router.allowedMethods())
	.use(work_router.routes(), work_router.allowedMethods())
	.use(logs_router.routes(), logs_router.allowedMethods())
	.use(pdf_router.routes(), pdf_router.allowedMethods())

router.all('*', async function (ctx, next) {
	ctx.redirect('/404.html')
})

module.exports = router
